<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAkbusTaskSalaryElectricTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_task_salary_electric', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->Integer('bus_id')->comment('车辆id');
            $table->integer('line')->nullable()->comment('线路');
            $table->string('license_plate_num')->nullable()->comment('车牌号');
            $table->date('date')->nullable()->comment('日期');
            $table->decimal('monthly_income',10,2)->nullable()->comment('月收入(刷卡、投币）');
            $table->decimal('contract',10,2)->nullable()->comment('包车收入');
            $table->decimal('free',10,2)->nullable()->comment('免票运量');
            $table->decimal('free_income',10,2)->nullable()->comment('免票收入');
            $table->decimal('income_total',10,2)->nullable()->comment('收入合计');
            $table->decimal('monthly_km',10,2)->nullable()->comment('月公里数');
            $table->decimal('monthly_cost',10,2)->nullable()->comment('月充电（金额）');
            $table->decimal('m_ele_total',10,2)->nullable()->comment('月充电量');
            $table->decimal('ele_increment',10,2)->nullable()->comment('充电量,增加额');
            $table->decimal('ele_rate',10,4)->nullable()->comment('充电量,增加率');
            $table->tinyInteger('ele_grade_one')->nullable()->comment('充电量,增减百分比在（+－1%含）之间，奖励40分');
            $table->tinyInteger('ele_grade_two')->nullable()->comment('充电量,节约或超过1%至3%（含）之间，奖励或扣减10分');
            $table->tinyInteger('ele_grade_three')->nullable()->comment('充电量,如节约或超过3%，奖励或扣减20分');
            $table->decimal('income_increment',10,2)->nullable()->comment('收入,增加额');
            $table->decimal('income_rate',10,4)->nullable()->comment('收入,增加率');
            $table->tinyInteger('income_grade_one')->nullable()->comment('收入,节约或超过1%至3%（含）之间，奖励或扣减10分');
            $table->tinyInteger('income_grade_two')->nullable()->comment('收入,如节约或超过3%，奖励或扣减20分');
            $table->tinyInteger('income_grade_three')->nullable()->comment('收入,节约或超过1%至3%（含）之间，奖励或扣减10分');
            $table->tinyInteger('traffic_grade_one')->nullable()->comment('交通事故（次责及以上） 单位：起');
            $table->tinyInteger('traffic_grade_two')->nullable()->comment('交通事故标准分值 15分');
            $table->tinyInteger('traffic_grade_three')->nullable()->comment('次责及以上交通事故，每起扣减5分');
            $table->tinyInteger('traffic_grade_four')->nullable()->comment('全责致人重伤或死亡的交通事故扣减全部15分');
            $table->decimal('mileage_increment',10,2)->nullable()->comment('公里数,增加额');
            $table->decimal('mileage_rate',10,4)->nullable()->comment('公里数,增加率');
            $table->tinyInteger('mileage_grade_one')->nullable()->comment('公里数,增减百分比在（+－1%含）之间，奖励5分');
            $table->tinyInteger('mileage_grade_two')->nullable()->comment('公里数节,约或超过1%至3%（含）之间，奖励或扣减2分');
            $table->tinyInteger('mileage_grade_three')->nullable()->comment('公里数,如节约或超过3%，奖励或扣减3分');
            $table->tinyInteger('total_grade')->nullable()->comment('分数合计');
            $table->tinyInteger('ranking')->nullable()->comment('排名');
            $table->decimal('reward_punish',10,2)->nullable()->comment('奖励/惩罚');
            $table->text('remark')->nullable()->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_task_salary_electric');
    }
}
